﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using KNXLibrary.Enum;
using System.Diagnostics;

namespace KNXFramework.Logging
{
    public static class CustomLogger
    {
        public static void WriteCriticalEntry(string message, Priority priority)
        {
            WriteEntry(message, priority, TraceEventType.Critical);
        }
        public static void WriteCriticalEntry(string message)
        {
            WriteCriticalEntry(message, Priority.Normal);
        }

        public static void WriteErrorEntry(string message, Priority priority)
        {
            WriteEntry(message, priority, TraceEventType.Error);
        }
        public static void WriteErrorEntry(string message)
        {
            WriteEntry(message, Priority.Normal, TraceEventType.Error);
        }

        public static void WriteInformationEntry(string message, Priority priority)
        {
            WriteEntry(message, priority, TraceEventType.Information);
        }
        public static void WriteInformationEntry(string message)
        {
            WriteEntry(message, Priority.Normal, TraceEventType.Information);
        }

        public static void WriteVerboseEntry(string message, Priority priority)
        {
            WriteEntry(message, priority, TraceEventType.Verbose);
        }
        public static void WriteVerboseEntry(string message)
        {
            WriteEntry(message, Priority.Normal, TraceEventType.Verbose);
        }

        private static void WriteEntry(string message, Priority priority, TraceEventType eventType)
        {
            Logger.Write(new LogEntry(message, "General", (int)priority, 0, eventType, "", null));            
        }


    }
}
